package generics;

/**
 * @author 杨宇
 * @version 1.0 2016/11/2
 */
public class E25_Bounds {

    static <T extends Top> void top(T obj) {
        obj.c();
        obj.d();
    }

    static <T extends Low> void low(T obj) {
        obj.a();
        obj.b();
    }

    public static void main(String[] args) {
        LowAndTop lat = new LowAndTop();
        top(lat);
        low(lat);
    }
}

interface Low {
    void a();

    void b();
}

interface Top {
    void c();

    void d();
}

class LowAndTop implements Low, Top {
    @Override
    public void a() {
        System.out.println("a");
    }

    @Override
    public void b() {
        System.out.println("b");
    }

    @Override
    public void c() {
        System.out.println("c");
    }

    @Override
    public void d() {
        System.out.println("d");
    }
}